#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>

#define BUF_SIZE 100

int main()
{
    char buf[BUF_SIZE];

    int fd = open("data.txt", O_RDONLY);
    printf("文件描述符：%d\n", fd);

    read(fd, buf, sizeof(buf) - 1);
    printf("文件数据：%s", buf);

    close(fd);
    return 0;
}

